<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>签名在线调试工具</title>
    <meta name="author" content="yeshop Team" />
    <meta name="copyright" content="yeshop" />
    <link rel="icon" href="">
    <link href="https://static.9hive.cn/global/vendor/bootstrap-3.3.7/bootstrap.min.css" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/nprogress/nprogress.css" rel="stylesheet">
    <link href="https://static.9hive.cn/global/fonts/font-awesome/font-awesome.min.css" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/icheck/icheck.min.css" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/animate/animate.css" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/bootstrap-table-1.11/bootstrap-table.min.css?v=1.1" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/common/common_20170925.css" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/inside/inside.css?v=1" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/file/file.css" rel="stylesheet">
<body class="white-bg">
<div class="wrapper wrapper-content ibox float-e-margins">

    <h4 style="margin-bottom: 15px;margin-top:15px;color: #5EABE8;width: 30%;text-align: center" >签名在线调试工具</h4>
    <div class="ibox-content">
        <form method="post" action="" class="form-horizontal form-validate">
            <input type="hidden" name="admin.id" value="${admin.id!}"/>

            <div class="form-group">
                <label class="col-sm-2 control-label">接口传入数据: </label>
                <div class="col-sm-3">
                    <textarea  rows="7"  class="form-control input-sm" id="jsonData" autocomplete="off"></textarea>
                </div>
                <span class="help-block"><span class="maroon">*</span>请填写json格式,如:{"storeId":"门店id"}</span>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label" >时间戳: </label>
                <div class="col-sm-3">
                    <input type="text" id="time_stamp" value="" class="form-control input-sm">
                </div>
                <span class="help-block"><span class="maroon">*</span>单位:ms</span>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label" >secret: </label>
                <div class="col-sm-3">
                    <input type="text" id="secret" value="" class="form-control input-sm" >
                </div>
                <span class="help-block"><span class="maroon">*</span></span>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">加密结果(小写): </label>
                <div class="col-sm-3">
                    <input readonly type="text" id="signature" value="" class="form-control input-sm" >
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">加密结果(大写): </label>
                <div class="col-sm-3">
                    <input readonly type="text" id="signatureUp" value="" class="form-control input-sm" >
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-4 col-sm-offset-2">
                    <div class="btn btn-primary" id="sign">签名</div>

                </div>
            </div>
        </form>
    </div>
</div>
<script src="https://static.9hive.cn/global/vendor/jquery/jquery-2.1.4.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/nprogress/nprogress.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-3.3.7/bootstrap.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-validate/jquery.validate.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-validate/additional-methods.min.js"></script>

<script src="https://static.9hive.cn/global/vendor/jquery-validate/localization/messages_zh.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-ajaxform/ajax-form.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-table-1.11/bootstrap-table.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-table-1.11/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/layer/layer.js"></script>
<!-- 自定义js -->
<script src="https://static.9hive.cn/global/vendor/inside/inside20170925.js"></script>

<script type="">
    $("#sign").click(function () {
        var jsonData=$("#jsonData").val();
        var time_stamp=$("#time_stamp").val();
        var secret=$("#secret").val();
        if(!jsonData){
            layer.msg("请输入接口传入数据");
            return;
        }

        if(jsonData.indexOf("{")==-1){
            layer.msg("接口传入数据格式错误");
            return;
        }
        if(jsonData.lastIndexOf("}")==-1){
            layer.msg("接口传入数据格式错误");
            return;
        }

        if(!time_stamp){
            layer.msg("请输入时间戳");
            return;
        }
        if(!secret){
            layer.msg("请输入秘钥");
            return;
        }
        $.ajax({
            url: "/test/jiami/sign",
            type: 'GET',
            data:{
                "jsonData": jsonData,
                "time_stamp": time_stamp,
                "secret": secret
            },
            success: function(data){
                if (data.state=="ok" == true){
                    $("#signature").val(data.signature);
                    $("#signatureUp").val(data.signatureUp);
                }else{
                    layer.msg(data.info);
                }
            }});
    });
</script>
</body>

</html>